package com.sen.patterns.behavioral.strategy.ex1;

import junit.framework.TestCase;

public class Test extends TestCase {
	
	public void testMallardDuck() {
		Duck duck = new MallardDuck();
		duck.display();
		duck.performFly();
		duck.performQuack();
	}
	
	public void testRedheadDuck() {
		Duck duck = new RedheadDuck();
		duck.display();
		duck.performFly();
		duck.performQuack();
	}
	
	public void testRubberDuck() {
		Duck duck = new RubberDuck();
		duck.display();
		duck.performFly();
		duck.performQuack();
	}
	
	public void testDecoyDuck() {
		Duck duck = new DecoyDuck();
		duck.display();
		duck.performFly();
		duck.performQuack();
	}
	
	public void testModelDuck() {
		Duck duck = new ModelDuck();
		duck.display();
		duck.performFly();
		duck.performQuack();
		
		// 动态改变鸭子的飞行行为
		duck.setFlyBehavior(new FlyRocketPowered());
		duck.performFly();
	}
	
}
